package spring.aop;

/**
 * 基于aspectj表达式切点的通知者实现
 */
public class AspectJPointcutAdvisor implements PointcutAdvisor {

    private String adviceBeanName;	// 通知bean名称

    private String expression;		// 切点表达式

    private Pointcut pointcut;	// aspectJ切点实例

    /**
     * 构造函数
     * @param adviceBeanName 通知bean名称
     * @param expression	切点表达式
     */
    public AspectJPointcutAdvisor(String adviceBeanName, String expression) {
        this.adviceBeanName = adviceBeanName;
        this.expression = expression;
        this.pointcut = new AspectJExpressionPointcut(this.expression);
    }

    @Override
    public Pointcut getPointcut() {
        return this.pointcut;
    }

    @Override
    public String getAdviceBeanName() {
        return this.adviceBeanName;
    }

    @Override
    public String getExpression() {
        return this.expression;
    }
}

